package it.infodea.tapestrydea.state.mail;

import java.util.ArrayList;
import java.util.List;

public class MailState {

	private List<String> names = new ArrayList<String>();
	private List<String> paths = new ArrayList<String>();
	private List<Long> sizes = new ArrayList<Long>();
	private long total = 0;

	public void add(String name, String path, long size){
		names.add(name);
		paths.add(path);
		sizes.add(size);
		total += size;
	}
	
	public String remove(int index){
		String name = names.remove(index);
		paths.remove(index);
		long removedSize = sizes.remove(index);
		total -= removedSize;
		return name;
	}
	
	public List<String> getNames() {
		return names;
	}

	public void setNames(List<String> names) {
		this.names = names;
	}

	public List<String> getPaths() {
		return paths;
	}

	public void setPaths(List<String> paths) {
		this.paths = paths;
	}

	public List<Long> getSizes() {
		return sizes;
	}

	public void setSizes(List<Long> sizes) {
		this.sizes = sizes;
	}

	public long getTotal() {
		return total;
	}

	public void setTotal(long total) {
		this.total = total;
	}

	public String getName(int index) {
		return names.size() > index ? names.get(index) : null;
	}
	
	public Long getSize(int index) {
		return sizes.size() > index ? sizes.get(index) : null;
	}

	public void clean() {
		names = new ArrayList<String>();
		paths = new ArrayList<String>();
		sizes = new ArrayList<Long>();
		total = 0;
	}
	
}
